<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  
 </head>
 <body>
  <script>
var str = 'abcDEF';
console.log(str.search('c')); 	//返回2
console.log(str.search('d')); 	//返回-1
console.log(str.search(/d/i));	//返回3，正则语法/i表示忽视大小写

  </script>
 </body>
</html>
